<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="UTF-8">
        <title>管理员列表</title>
        <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" th:href="@{/opsadmin/css/font.css}">
        <link rel="stylesheet" th:href="@{/opsadmin/css/index.css}">
        <script th:src="@{/opsadmin/lib/layui/layui.js}" charset="utf-8"></script>
        <script type="text/javascript" th:src="@{/opsadmin/js/index.js}"></script>

    </head>
    <body>

        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">

                            <form class="layui-form x-center" action="/admin-article-list.html" style="width:880px">
                                <div class="layui-form-pane" style="margin-top: 15px;">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">日期范围</label>
                                        <div class="layui-input-inline">
                                            <input th:value="${selectParam.createtime1}" type="date" name="createtime1" class="layui-input" placeholder="开始日" id="LAY_demorange_s">
                                        </div>
                                        <div class="layui-input-inline">
                                            <input th:value="${selectParam.createtime2}" type="date" name="createtime2" class="layui-input" placeholder="截止日" id="LAY_demorange_e">
                                        </div>
                                        <div class="layui-input-inline">
                                            <input th:value="${selectParam.keyword}" type="text" name="keyword"  placeholder="标题" autocomplete="off" class="layui-input">
                                        </div>

                                        <div class="layui-input-inline" style="width:80px">
                                            <button class="layui-btn"  type="submit" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                                            </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="layui-card-header">
                            <button class="layui-btn" onclick="xadmin.open('发布新帖子','admin-article-add.html',600,400)"><i class="layui-icon"></i>添加</button>
                        </div>
                        <div class="layui-card-body ">
                            <table class="layui-table">
                                <thead>
                                <tr>
                                    <th>配图</th>
                                    <th>标题</th>
                                    <th>分类</th>
                                    <th>内容</th>
                                    <th>浏览次数</th>
                                    <th>创建时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr th:each="article:${pageInfo.list}">
                                    <td>
                                        <img width="100" height="63" th:src="${article.img}" alt="配图">
                                    </td>
                                    <td th:text="${article.title}"></td>
                                    <td th:text="${article.lname}"></td>
                                    <td th:text="${article.content}" ></td>
                                    <td th:text="${article.heat}" ></td>
                                    <td th:text="${article.createtime}" ></td>
                                    <td class="td-manage">
                                        <a href="javascript:;" title="编辑"  th:onclick="|xadmin.open('编辑','admin-article-update.html?id=${article.id}','590','550')|"
                                           class="ml-5" style="text-decoration:none">
                                            <i class="layui-icon">&#xe642;</i>
                                        </a>
                                        <a href="javascript:;" title="删除" th:onclick="|member_del(this,'${article.id}')|"
                                           style="text-decoration:none">
                                            <i class="layui-icon">&#xe640;</i>
                                        </a>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <div class="layui-card-body ">
                            <div class="page">
                                <div>
                                    <a class="num" th:each="pages:${pageInfo.navigatepageNums}" th:class="${pages==selectParam.pageNum?'layui-bg-green layui-btn-disabled':'num'}" th:href="@{/ops-article-list.html(pageNum=${pages},pageSize=${selectParam.pageSize})}" th:text="${pages}">1</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
    <script>
      layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;

        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });
      });


      /*用户-删除*/
      function member_del(obj,id){
          layer.confirm('确认要删除吗？',function(index){
               $.ajax({
                       url:"/admin/article/deleted",
                       type:"post",
                       dataType:"json",
                       data:{"id":id},
                       success:function (data){
                           layer.msg('已删除!',{icon:1,time:1000});
                           location.reload();
                       }
                   });
          });
      }


    </script>

</html>
